let observerComponment = require('../../common/lib/observer').observerComponment;
let train_set_store = require("./train_set_store").train_set_store
let op_train_set = require("../../util/op_train_set")

let app = getApp()

Component(observerComponment({
	props: {
		store: train_set_store,
		common_store: app.data.common_store
	},
	data: {
		
	},
	// lifetimes: {
	// 	attached: function() {
	// 		// 在组件实例进入页面节点树时执行
	// 		console.log(this.props)
			
	// 	},
	// 	detached: function() {
	// 		// 在组件实例被从页面节点树移除时执行
	// 	},
	// },
	methods: {
		change_train_letter_state(e) {
			let idx = e.target.dataset.index
			this.props.common_store.train_set.letter_all[idx].selected = !this.props.common_store.train_set.letter_all[idx].selected

		},
		cxl() {
			this.props.store.body_style = "body_hide"
		},
		update_train_set() {
			this.props.store.body_style = "body_hide"
			this.props.common_store.train_set.letter_set = []
			for(let i = 0; i < this.props.common_store.train_set.letter_all.length; i ++) {
				if(this.props.common_store.train_set.letter_all[i].selected) {
					this.props.common_store.train_set.letter_set.push(this.props.common_store.train_set.letter_all[i].letter)
				}
			}
			op_train_set.syn_train_set()
		}
	}
}))
